package cn.doit.bean

class RichString(val str:String){
  def toIntPlus=try{
    str.toInt
  }catch {
    case _: Exception=>0
  }


  def toDoublePlus=try{
    str.toDouble
  }catch {
    case _: Exception=>0d
  }
}

object RichString{
  /**
    * 将String隐式转换成richString
    */
  implicit def str2RichString(str:String)=new RichString(str)
}


